package com.mc.servlet;


import com.mc.bean.Student;
import com.mc.service.StudentService;
import com.mc.service.impl.StudentServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 用户名称检查控制器
 */
@WebServlet("/usernamecheck.action")
public class StudentTelCheckServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //创建学生业务逻辑对象
        StudentService studentService = new StudentServiceImpl();
        //得到用户名字
        String name = req.getParameter("name");
      Student student = studentService.findByStel("stel");
        //输出
       resp.getWriter().print(student);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
